import ulj2me.*;

public class JFrmPage4 extends JULFrame
{
	JULMenu m_Menu;

	JULListMenu m_ListMenu;

	public JFrmPage4()
	{
		super();
	}

	public void OnCreate()
	{
		super.OnCreate();

		m_ListMenu=new JULListMenu();
		m_ListMenu.CreateWnd(this,0,0, m_rectWnd.cx,m_rectWnd.cy);
		m_ListMenu.SetItemHeight(JULWorkSpace.GetLogUnit()*2);
		m_ListMenu.AddItem("/MMenuItem.png","item item item item item "+0,""+0,0);
		m_ListMenu.AddItem("/MMenuItem.png","item item item item item "+1,""+1,1);
		m_ListMenu.AddItem("/MMenuItem.png","item item item item item "+2,""+2,2);
		for(int i=3;i<15;++i)
			m_ListMenu.AddItem("/MMenuItem.png","item "+i,""+i,i);


		m_Menu=new JULMenu();
		m_Menu.Create(this);
		m_Menu.SetKeyText(JULMenu.LEFTKEY,"menu");
		m_Menu.SetKeyText(JULMenu.RIGHTKEY,"next");
	}
	public void OnSize(int w,int h)
	{
		super.OnSize(w,h);
		m_ListMenu.SetPos(0,0, m_rectWnd.cx,m_rectWnd.cy,SWP_MOVE|SWP_SIZE|SWP_NOTIFY);
	}
	public void OnCmd(JULWnd wndSender,byte nType)
	{
		if(JFrmMain.IsMainMsg(nType))
			return;

		if(nType==MN_LEFTKEY)
		{
			JULPopupMenu pmenu=new JULPopupMenu();
			pmenu.Create(this);

			JFrmMain.FillVertMenu(pmenu);

			JULPoint pt=JULWorkSpace.GetScreenSize();
			int y=pt.y;
			if(m_Menu.IsOpen())
				y-=JULWorkSpace.GetLogUnit();
			pmenu.Track(0,y,JULPopupMenu.TOPRIGHT);
		}
		if(nType==MN_RIGHTKEY)
		{
			Destroy();
			m_frmOwner.OnCmd(this,JFrmMain.N_PAGE1);
		}
		System.out.println("listmenu="+nType);
	}
}
